﻿using Newtonsoft.Json;
using shuatibao.Question;
using shuatibao.Tool;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;

namespace shuatibao.Web.Question
{
    /// <summary>
    /// Question_List 的摘要说明
    /// </summary>
    public class Question_List : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

         

            // 获取POST请求的JSON数据
            string requestJson = new StreamReader(context.Request.InputStream).ReadToEnd();

            QuestionRequest questionModel = JsonConvert.DeserializeObject<QuestionRequest>(requestJson);
            List<QuestionModel> list = QuestionAction.getQuestionListManager(questionModel);
            OUTQuestionListModel outModel = new OUTQuestionListModel();

            QuestionListModel listModel = new QuestionListModel();
            listModel.list = list;
            outModel.code = "200";
            outModel.data = listModel;
            outModel.error = "";
            string jsonStr = Utils.toJSON(outModel);

            Utils.jsonBackManager(context, jsonStr);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}